<?php
/**
 * Created by PhpStorm.
 * User: skytop
 * Date: 16-8-27
 * Time: 下午6:03
 */

namespace Admin\Controller;
use Think\Controller;

class SystemController extends Controller
{
    public function verify(){
        if(IS_POST){
            $url=APP_PATH."/Admin/Conf/verify.php";
            if(!is_numeric(I("post.captcha_length"))){
                $url=false;
            }

            $res=var_export($_POST,true);
            $str=<<<STO
<?php
return $res;
STO;
            if(file_put_contents($url,$str)){
                chmod($url,0777);
                $this->success("修改配置成功!",U("System/view"));
            }else{
                $this->error("修改失败,请填写数字!",U("System/verify"));
            }

        }else {
            $this->display();
        }
    }

    public function view(){
        echo "<img src=".U("Login/captcha?atype=login")."\" />";
    }
}